﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Net;

namespace PASNew.UserControls.V2
{
    public partial class Contact : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void lbSubmit_Click(object sender, EventArgs e)
        {
            MailAddress FromMailAddress = new MailAddress("system.pas@gmail.com");
            MailAddress ToMailAddress = new MailAddress("ross.rawlins@gmail.com");
            MailMessage MailMsg = new MailMessage();
            MailMsg.From = FromMailAddress;
            MailMsg.To.Add(ToMailAddress);
            MailMsg.Subject = "PAS";
            
            MailMsg.Body = tbName.Text + " " + tbEmail.Text + " " + tbPhone.Text + " " + tbMessage.Text;
            NetworkCredential credentials = new NetworkCredential("support@passystem.co.za", "P@Ssyst3m");
            SmtpClient MailSender = new SmtpClient("mail.passystem.co.za");
            MailSender.Credentials = credentials;
            MailSender.Send(MailMsg);
        }

        protected void lbClear_Click(object sender, EventArgs e)
        {
            tbName.Text = string.Empty;
            tbPhone.Text = string.Empty;
            tbEmail.Text = string.Empty;
            tbMessage.Text = string.Empty;
        }
    }
}